class Field(object):
	def __init__(self, data, name, g=[], *arguments, **keywords):
		self.data = data
		self.name = name
		if len(g) != self.data.settings.dimensions:
			self.g = []
			for i in range(0, self.data.settings.dimensions):
				self.g.append(0.0)
			del i
			self.g[-1] = -9.81
		else:
			self.g = g
	
	def deleteField(self):
		for member in self.data.members.values():
			for f in member.fields:
				if f is self:
					member.fields.remove(f)
		for node in self.data.nodes.values():
			for f in node.fields:
				if f is self:
					node.fields.remove(f)
		del self.data.fields[self.name]
	
	def __repr__(self):
		return "{Field: {name: %s, g: %s}}" % (self.name, self.g)
